<?php
	session_start();
	include("functions.php");
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>Cambodia Job</title>
		<link href="css/bootstrap.css" rel="stylesheet"/>
		<link href="css/bootstrap-responsive.css" rel="stylesheet"/>
		<link href='css/custom.css' rel='stylesheet'/>
		<script src="js/jquery-1.9.1.js"></script>
		<script src="js/bootstrap.js"></script>
		<script>
			window.onload=function(){
				document.querySelector("ul#nav li:nth-child(5)").classList.add("active");
			};
		</script>
	</head>
	<body>
		<div class="container">
			<?php 
				if(!isset($_SESSION["userid"])){
					getHeader();
				}
				else{
			?>
				<div class='row-fluid row-header'>
				<div class='span3 text-center'>
				<a href='/cambodiajob/index.php'>
				<img src='/cambodiajob/img/logo_kh.png' alt='Khschools.com' />
				</a></div>
				<div class='span9'>
				<ul class='nav nav-pills pull-right' id='nav'>
					<li><a href='/cambodiajob/index.php' class='text-white'>Home</a></li>
					<li><a href='/cambodiajob/about.php' class='text-white'>About Us</a></li>
					<li><a href='/cambodiajob/#' class='text-white'>Contact Us</a></li>
					<li><a href="logout.php" class="text-white" id="btnlogout">Logout</a></li>
					</ul></div></div>
			<?php
				}
			?>
		</div>
		<div class='container' style='margin-top: 18px;'>
		<h3 class='text-info'>Become our member!</h3><hr/>
		<ul class="nav nav-tabs">
			<li class="active"><a href="#d1" data-toggle="tab">Job Provider</a></li>
			<li><a href="#d2" data-toggle="tab">Job Seeker</a></li>
		</ul>
		<div class="tab-content">
			<div id="d1" class="tab-pane active">
				<form method="post">
					<table>
						<tr>
							<td>Full Name</td>
							<td><input type="text" size="22" id="txtname" name="txtname" required 
								value="<?php echo @$_POST['txtname']; ?>"/></td>
							<td>&nbsp;&nbsp;<span id="s1"></span></td>
						</tr>
						<tr>
							<td>Position</td>
							<td><input type="text" size="22" id="txtpos" name="txtpos" required 
								value="<?php echo @$_POST['txtpos']; ?>"/></td>
							<td>&nbsp;&nbsp;<span id="s2"></span></td>
						</tr>
						<tr>
							<td>Company Name</td>
							<td><input type="text" size="22" id="txtcom" name="txtcom" required 
								value="<?php echo @$_POST['txtcom']; ?>"/></td>
							<td>&nbsp;&nbsp;<span id="s3"></span></td>
						</tr>
						<tr>
							<td>E-mail Address</td>
							<td><input type="email" size="22" id="txtmail" name="txtmail" required 
								value="<?php echo @$_POST['txtmail']; ?>"/></td>
							<td>&nbsp;&nbsp;<span id="s4"></span></td>
						</tr>
						<tr>
							<td>Password</td>
							<td><input type="password" size="22" id="pass" name="pass" required
								value="<?php echo @$_POST['pass']; ?>"/></td>
							<td>&nbsp;&nbsp;<span id="indicater"></span></td>
						</tr>
						<tr>
							<td>Confirm Password &nbsp;&nbsp;</td>
							<td><input type="password" size="22" id="cpass" name="cpass" required 
								value="<?php echo @$_POST['cpass']; ?>"/></td>
							<td>&nbsp;&nbsp;<span id="s5"></span></td>
						</tr>
						<tr>
							<td></td>
							<td><input type="submit" value="Register" name="btnsubmit" id="btnsubmit" class="btn btn-success" />
								<input type="button" value="Cancel" name="btncancel" id="btncancel" class="btn btn-info" /></td>
							<td></td>
						</tr>
						<tr>
							<td colspan="3">
								<?php 
									if(isset($_POST['btnsubmit']))
									{
										$info =array($_POST['txtname'],$_POST['txtpos'],
											$_POST['txtcom'],$_POST['txtmail'],
											$_POST['pass'],$_POST['cpass']);
										$val = validateEmployerInfo($info);
										$info1=array($_POST['txtname'],$_POST['txtpos'],
												NULL,$_POST['txtmail'],
												$_POST['pass']);
										if($val=="OK")
										{
											if(addEmployer($info1))
											{
												echo "Data has been saved!";
											}
											else {
												echo "Fail!";
											}
										}
										else
										{
											echo "<p id='sms' style='color: red;border:1px solid red;padding:6px;'>*** " .$val. "</p>";
										}
									}
								?>
							</td>
						</tr>
					</table>
				</form>
			</div>
			<div id="d2" class="tab-pane">
				Content #2
			</div>
		</div>
		<div></div>
		<div></div>
		</div>
		<script src="js/custom.js"></script>
	</body>
</html>